<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Kyoto Cabinet: kyotocabinet::MapReduce Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Kyoto Cabinet
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="namespacekyotocabinet.html">kyotocabinet</a>      </li>
      <li class="navelem"><a class="el" href="classkyotocabinet_1_1MapReduce.html">MapReduce</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">kyotocabinet::MapReduce Class Reference</div>  </div>
</div><!--header-->
<div class="contents">
<!-- doxytag: class="kyotocabinet::MapReduce" -->
<p><a class="el" href="classkyotocabinet_1_1MapReduce.html" title="MapReduce framework.">MapReduce</a> framework.  
 <a href="classkyotocabinet_1_1MapReduce.html#details">More...</a></p>

<p><code>#include &lt;kcdbext.h&gt;</code></p>

<p><a href="classkyotocabinet_1_1MapReduce-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><b>FlushThread</b></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Cache flusher. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><b>MapChecker</b></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Checker for the map process. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><b>MapVisitor</b></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Visitor for the map process. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><b>MergeLine</b></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Front line of a merging list. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><b>ReduceTaskQueue</b></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Task queue for parallel reducer. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1MapReduce_1_1ValueIterator.html">ValueIterator</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Value iterator for the reducer.  <a href="classkyotocabinet_1_1MapReduce_1_1ValueIterator.html#details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1MapReduce.html#a59a43dbd3b73c163942960cf87b201dd">Option</a> { <br/>
&#160;&#160;<a class="el" href="classkyotocabinet_1_1MapReduce.html#a59a43dbd3b73c163942960cf87b201dda7755be537e266017d8b78b3bafb5f1dd">XNOLOCK</a> =  1 &lt;&lt; 0, 
<a class="el" href="classkyotocabinet_1_1MapReduce.html#a59a43dbd3b73c163942960cf87b201ddada1bdc6aaef409a033b57756a8b1bcbd">XPARAMAP</a> =  1 &lt;&lt; 1, 
<a class="el" href="classkyotocabinet_1_1MapReduce.html#a59a43dbd3b73c163942960cf87b201dda8b81ff7d876ac83a66635d7a36cd9d62">XPARARED</a> =  1 &lt;&lt; 2, 
<a class="el" href="classkyotocabinet_1_1MapReduce.html#a59a43dbd3b73c163942960cf87b201dda9f880aaab20112c2b1e11acf7940f376">XPARAFLS</a> =  1 &lt;&lt; 3, 
<br/>
&#160;&#160;<a class="el" href="classkyotocabinet_1_1MapReduce.html#a59a43dbd3b73c163942960cf87b201ddaa36e72ad9da0e9ce2a8c31a3a44b9716">XNOCOMP</a> =  1 &lt;&lt; 8
<br/>
 }</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Execution options.  <a href="classkyotocabinet_1_1MapReduce.html#a59a43dbd3b73c163942960cf87b201dd">More...</a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1MapReduce.html#ad94405a7bd1231c5369bdf624eae48ab">MapReduce</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Default constructor.  <a href="#ad94405a7bd1231c5369bdf624eae48ab"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1MapReduce.html#af1add4677e3fe4eae7ac799f8cf110ce">~MapReduce</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor.  <a href="#af1add4677e3fe4eae7ac799f8cf110ce"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1MapReduce.html#af4a8f43ce86a499672939d077791c7b7">map</a> (const char *kbuf, size_t ksiz, const char *vbuf, size_t vsiz)=0</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Map a record data.  <a href="#af4a8f43ce86a499672939d077791c7b7"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1MapReduce.html#aeab1043e26d29c1cb37c2582ab359821">reduce</a> (const char *kbuf, size_t ksiz, <a class="el" href="classkyotocabinet_1_1MapReduce_1_1ValueIterator.html">ValueIterator</a> *iter)=0</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Reduce a record data.  <a href="#aeab1043e26d29c1cb37c2582ab359821"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1MapReduce.html#a7702066bcf52aa6c4548a9fa9ba83fd6">preprocess</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Preprocess the map operations.  <a href="#a7702066bcf52aa6c4548a9fa9ba83fd6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1MapReduce.html#ab5dfd1a76e56cb329deeaeedc341ea94">midprocess</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Mediate between the map and the reduce phases.  <a href="#ab5dfd1a76e56cb329deeaeedc341ea94"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1MapReduce.html#aa89ffeddd16c24f6e93bfc1be2ba4e20">postprocess</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Postprocess the reduce operations.  <a href="#aa89ffeddd16c24f6e93bfc1be2ba4e20"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1MapReduce.html#acf8b6e8bfbd50ca3a226624fac04091d">log</a> (const char *name, const char *message)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Process a log message.  <a href="#acf8b6e8bfbd50ca3a226624fac04091d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1MapReduce.html#a7aa3490fcb749154f158aec35234b4ce">execute</a> (<a class="el" href="classkyotocabinet_1_1BasicDB.html">BasicDB</a> *db, const std::string &amp;tmppath=&quot;&quot;, uint32_t opts=0)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Execute the <a class="el" href="classkyotocabinet_1_1MapReduce.html" title="MapReduce framework.">MapReduce</a> process about a database.  <a href="#a7aa3490fcb749154f158aec35234b4ce"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1MapReduce.html#ab8d38fb10c49d2c26d9681910d96dd77">tune_storage</a> (int32_t dbnum, int64_t clim, int64_t cbnum)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the storage configurations.  <a href="#ab8d38fb10c49d2c26d9681910d96dd77"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1MapReduce.html#a4d5fe4baae1b02eaf44a1d0f55329df8">tune_thread</a> (int32_t mapthnum, int32_t redthnum, int32_t flsthnum)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the thread configurations.  <a href="#a4d5fe4baae1b02eaf44a1d0f55329df8"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classkyotocabinet_1_1MapReduce.html#a5c13597daf05ae2c0f7cc034b62472a3">emit</a> (const char *kbuf, size_t ksiz, const char *vbuf, size_t vsiz)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Emit a record from the mapper.  <a href="#a5c13597daf05ae2c0f7cc034b62472a3"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classkyotocabinet_1_1MapReduce.html" title="MapReduce framework.">MapReduce</a> framework. </p>
<dl class="note"><dt><b>Note:</b></dt><dd>Although this framework is not distributed or concurrent, it is useful for aggregate calculation with less CPU loading and less memory usage. </dd></dl>
</div><hr/><h2>Member Enumeration Documentation</h2>
<a class="anchor" id="a59a43dbd3b73c163942960cf87b201dd"></a><!-- doxytag: member="kyotocabinet::MapReduce::Option" ref="a59a43dbd3b73c163942960cf87b201dd" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="classkyotocabinet_1_1MapReduce.html#a59a43dbd3b73c163942960cf87b201dd">kyotocabinet::MapReduce::Option</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Execution options. </p>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="a59a43dbd3b73c163942960cf87b201dda7755be537e266017d8b78b3bafb5f1dd"></a><!-- doxytag: member="XNOLOCK" ref="a59a43dbd3b73c163942960cf87b201dda7755be537e266017d8b78b3bafb5f1dd" args="" -->XNOLOCK</em>&nbsp;</td><td>
<p>avoid locking against update operations </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a59a43dbd3b73c163942960cf87b201ddada1bdc6aaef409a033b57756a8b1bcbd"></a><!-- doxytag: member="XPARAMAP" ref="a59a43dbd3b73c163942960cf87b201ddada1bdc6aaef409a033b57756a8b1bcbd" args="" -->XPARAMAP</em>&nbsp;</td><td>
<p>run mappers in parallel </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a59a43dbd3b73c163942960cf87b201dda8b81ff7d876ac83a66635d7a36cd9d62"></a><!-- doxytag: member="XPARARED" ref="a59a43dbd3b73c163942960cf87b201dda8b81ff7d876ac83a66635d7a36cd9d62" args="" -->XPARARED</em>&nbsp;</td><td>
<p>run reducers in parallel </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a59a43dbd3b73c163942960cf87b201dda9f880aaab20112c2b1e11acf7940f376"></a><!-- doxytag: member="XPARAFLS" ref="a59a43dbd3b73c163942960cf87b201dda9f880aaab20112c2b1e11acf7940f376" args="" -->XPARAFLS</em>&nbsp;</td><td>
<p>run cache flushers in parallel </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a59a43dbd3b73c163942960cf87b201ddaa36e72ad9da0e9ce2a8c31a3a44b9716"></a><!-- doxytag: member="XNOCOMP" ref="a59a43dbd3b73c163942960cf87b201ddaa36e72ad9da0e9ce2a8c31a3a44b9716" args="" -->XNOCOMP</em>&nbsp;</td><td>
<p>avoid compression of temporary databases </p>
</td></tr>
</table>
</dd>
</dl>

</div>
</div>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="ad94405a7bd1231c5369bdf624eae48ab"></a><!-- doxytag: member="kyotocabinet::MapReduce::MapReduce" ref="ad94405a7bd1231c5369bdf624eae48ab" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classkyotocabinet_1_1MapReduce.html#ad94405a7bd1231c5369bdf624eae48ab">kyotocabinet::MapReduce::MapReduce</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [explicit]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Default constructor. </p>

</div>
</div>
<a class="anchor" id="af1add4677e3fe4eae7ac799f8cf110ce"></a><!-- doxytag: member="kyotocabinet::MapReduce::~MapReduce" ref="af1add4677e3fe4eae7ac799f8cf110ce" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual <a class="el" href="classkyotocabinet_1_1MapReduce.html#af1add4677e3fe4eae7ac799f8cf110ce">kyotocabinet::MapReduce::~MapReduce</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Destructor. </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="af4a8f43ce86a499672939d077791c7b7"></a><!-- doxytag: member="kyotocabinet::MapReduce::map" ref="af4a8f43ce86a499672939d077791c7b7" args="(const char *kbuf, size_t ksiz, const char *vbuf, size_t vsiz)=0" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool <a class="el" href="classkyotocabinet_1_1MapReduce.html#af4a8f43ce86a499672939d077791c7b7">kyotocabinet::MapReduce::map</a> </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>kbuf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>ksiz</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>vbuf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>vsiz</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [pure virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Map a record data. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">kbuf</td><td>the pointer to the key region. </td></tr>
    <tr><td class="paramname">ksiz</td><td>the size of the key region. </td></tr>
    <tr><td class="paramname">vbuf</td><td>the pointer to the value region. </td></tr>
    <tr><td class="paramname">vsiz</td><td>the size of the value region. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>true on success, or false on failure. </dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>This function can call the <a class="el" href="classkyotocabinet_1_1MapReduce.html#a5c13597daf05ae2c0f7cc034b62472a3" title="Emit a record from the mapper.">MapReduce::emit</a> method to emit a record. To avoid deadlock, any explicit database operation must not be performed in this function. </dd></dl>

</div>
</div>
<a class="anchor" id="aeab1043e26d29c1cb37c2582ab359821"></a><!-- doxytag: member="kyotocabinet::MapReduce::reduce" ref="aeab1043e26d29c1cb37c2582ab359821" args="(const char *kbuf, size_t ksiz, ValueIterator *iter)=0" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool <a class="el" href="classkyotocabinet_1_1MapReduce.html#aeab1043e26d29c1cb37c2582ab359821">kyotocabinet::MapReduce::reduce</a> </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>kbuf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>ksiz</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classkyotocabinet_1_1MapReduce_1_1ValueIterator.html">ValueIterator</a> *&#160;</td>
          <td class="paramname"><em>iter</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [pure virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Reduce a record data. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">kbuf</td><td>the pointer to the key region. </td></tr>
    <tr><td class="paramname">ksiz</td><td>the size of the key region. </td></tr>
    <tr><td class="paramname">iter</td><td>the iterator to get the values. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>true on success, or false on failure. </dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>To avoid deadlock, any explicit database operation must not be performed in this function. </dd></dl>

</div>
</div>
<a class="anchor" id="a7702066bcf52aa6c4548a9fa9ba83fd6"></a><!-- doxytag: member="kyotocabinet::MapReduce::preprocess" ref="a7702066bcf52aa6c4548a9fa9ba83fd6" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool <a class="el" href="classkyotocabinet_1_1MapReduce.html#a7702066bcf52aa6c4548a9fa9ba83fd6">kyotocabinet::MapReduce::preprocess</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Preprocess the map operations. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>true on success, or false on failure. </dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>This function can call the <a class="el" href="classkyotocabinet_1_1MapReduce.html#a5c13597daf05ae2c0f7cc034b62472a3" title="Emit a record from the mapper.">MapReduce::emit</a> method to emit a record. To avoid deadlock, any explicit database operation must not be performed in this function. </dd></dl>

</div>
</div>
<a class="anchor" id="ab5dfd1a76e56cb329deeaeedc341ea94"></a><!-- doxytag: member="kyotocabinet::MapReduce::midprocess" ref="ab5dfd1a76e56cb329deeaeedc341ea94" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool <a class="el" href="classkyotocabinet_1_1MapReduce.html#ab5dfd1a76e56cb329deeaeedc341ea94">kyotocabinet::MapReduce::midprocess</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Mediate between the map and the reduce phases. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>true on success, or false on failure. </dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>This function can call the <a class="el" href="classkyotocabinet_1_1MapReduce.html#a5c13597daf05ae2c0f7cc034b62472a3" title="Emit a record from the mapper.">MapReduce::emit</a> method to emit a record. To avoid deadlock, any explicit database operation must not be performed in this function. </dd></dl>

</div>
</div>
<a class="anchor" id="aa89ffeddd16c24f6e93bfc1be2ba4e20"></a><!-- doxytag: member="kyotocabinet::MapReduce::postprocess" ref="aa89ffeddd16c24f6e93bfc1be2ba4e20" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool <a class="el" href="classkyotocabinet_1_1MapReduce.html#aa89ffeddd16c24f6e93bfc1be2ba4e20">kyotocabinet::MapReduce::postprocess</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Postprocess the reduce operations. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>true on success, or false on failure. </dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>To avoid deadlock, any explicit database operation must not be performed in this function. </dd></dl>

</div>
</div>
<a class="anchor" id="acf8b6e8bfbd50ca3a226624fac04091d"></a><!-- doxytag: member="kyotocabinet::MapReduce::log" ref="acf8b6e8bfbd50ca3a226624fac04091d" args="(const char *name, const char *message)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool <a class="el" href="classkyotocabinet_1_1MapReduce.html#acf8b6e8bfbd50ca3a226624fac04091d">kyotocabinet::MapReduce::log</a> </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>message</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Process a log message. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">name</td><td>the name of the event. </td></tr>
    <tr><td class="paramname">message</td><td>a supplement message. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>true on success, or false on failure. </dd></dl>

</div>
</div>
<a class="anchor" id="a7aa3490fcb749154f158aec35234b4ce"></a><!-- doxytag: member="kyotocabinet::MapReduce::execute" ref="a7aa3490fcb749154f158aec35234b4ce" args="(BasicDB *db, const std::string &amp;tmppath=&quot;&quot;, uint32_t opts=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="classkyotocabinet_1_1MapReduce.html#a7aa3490fcb749154f158aec35234b4ce">kyotocabinet::MapReduce::execute</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classkyotocabinet_1_1BasicDB.html">BasicDB</a> *&#160;</td>
          <td class="paramname"><em>db</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>tmppath</em> = <code>&quot;&quot;</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>opts</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Execute the <a class="el" href="classkyotocabinet_1_1MapReduce.html" title="MapReduce framework.">MapReduce</a> process about a database. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">db</td><td>the source database. </td></tr>
    <tr><td class="paramname">tmppath</td><td>the path of a directory for the temporary data storage. If it is an empty string, temporary data are handled on memory. </td></tr>
    <tr><td class="paramname">opts</td><td>the optional features by bitwise-or: <a class="el" href="classkyotocabinet_1_1MapReduce.html#a59a43dbd3b73c163942960cf87b201dda7755be537e266017d8b78b3bafb5f1dd" title="avoid locking against update operations">MapReduce::XNOLOCK</a> to avoid locking against update operations by other threads, <a class="el" href="classkyotocabinet_1_1MapReduce.html#a59a43dbd3b73c163942960cf87b201ddada1bdc6aaef409a033b57756a8b1bcbd" title="run mappers in parallel">MapReduce::XPARAMAP</a> to run the mapper in parallel, <a class="el" href="classkyotocabinet_1_1MapReduce.html#a59a43dbd3b73c163942960cf87b201dda8b81ff7d876ac83a66635d7a36cd9d62" title="run reducers in parallel">MapReduce::XPARARED</a> to run the reducer in parallel, <a class="el" href="classkyotocabinet_1_1MapReduce.html#a59a43dbd3b73c163942960cf87b201ddaa36e72ad9da0e9ce2a8c31a3a44b9716" title="avoid compression of temporary databases">MapReduce::XNOCOMP</a> to avoid compression of temporary databases. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>true on success, or false on failure. </dd></dl>

</div>
</div>
<a class="anchor" id="ab8d38fb10c49d2c26d9681910d96dd77"></a><!-- doxytag: member="kyotocabinet::MapReduce::tune_storage" ref="ab8d38fb10c49d2c26d9681910d96dd77" args="(int32_t dbnum, int64_t clim, int64_t cbnum)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classkyotocabinet_1_1MapReduce.html#ab8d38fb10c49d2c26d9681910d96dd77">kyotocabinet::MapReduce::tune_storage</a> </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>dbnum</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64_t&#160;</td>
          <td class="paramname"><em>clim</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64_t&#160;</td>
          <td class="paramname"><em>cbnum</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set the storage configurations. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">dbnum</td><td>the number of temporary databases. </td></tr>
    <tr><td class="paramname">clim</td><td>the limit size of the internal cache. </td></tr>
    <tr><td class="paramname">cbnum</td><td>the bucket number of the internal cache. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a4d5fe4baae1b02eaf44a1d0f55329df8"></a><!-- doxytag: member="kyotocabinet::MapReduce::tune_thread" ref="a4d5fe4baae1b02eaf44a1d0f55329df8" args="(int32_t mapthnum, int32_t redthnum, int32_t flsthnum)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="classkyotocabinet_1_1MapReduce.html#a4d5fe4baae1b02eaf44a1d0f55329df8">kyotocabinet::MapReduce::tune_thread</a> </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>mapthnum</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>redthnum</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>flsthnum</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set the thread configurations. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">mapthnum</td><td>the number of threads for the mapper. </td></tr>
    <tr><td class="paramname">redthnum</td><td>the number of threads for the reducer. </td></tr>
    <tr><td class="paramname">flsthnum</td><td>the number of threads for the internal flusher. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a5c13597daf05ae2c0f7cc034b62472a3"></a><!-- doxytag: member="kyotocabinet::MapReduce::emit" ref="a5c13597daf05ae2c0f7cc034b62472a3" args="(const char *kbuf, size_t ksiz, const char *vbuf, size_t vsiz)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool <a class="el" href="classkyotocabinet_1_1MapReduce.html#a5c13597daf05ae2c0f7cc034b62472a3">kyotocabinet::MapReduce::emit</a> </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>kbuf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>ksiz</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>vbuf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>vsiz</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Emit a record from the mapper. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">kbuf</td><td>the pointer to the key region. </td></tr>
    <tr><td class="paramname">ksiz</td><td>the size of the key region. </td></tr>
    <tr><td class="paramname">vbuf</td><td>the pointer to the value region. </td></tr>
    <tr><td class="paramname">vsiz</td><td>the size of the value region. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>true on success, or false on failure. </dd></dl>

</div>
</div>
</div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Fri May 25 2012 01:21:36 for Kyoto Cabinet by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
